#include<cstdio>
using namespace std;
const int maxn = 10000006;
bool is_NP[maxn],vis[maxn];
double f[maxn];
int prime[maxn+2],cnt;
void get_prime()
{
	for(int i=2;i<=maxn;i++)
	{
		if(is_NP[i]==false)
		{
			prime[++cnt]=i;
		}
		for(int j=1;j<=cnt;j++)
		{
			if(i*prime[j] > maxn) break;
			is_NP[i*prime[j]]=1;
			if((i%prime[j])==0)break;
		}
	}
}
double dp(int x)
{
	if(x==1)return 0;
	if(vis[x])return f[x];
	vis[x]=1;
	int g=0,p=0;
	double ret = 0;
	f[x]=0;
	for(int i=1;i<=cnt && prime[i]<=x ; i++)
	{
		p++;
		if(x % prime[i] == 0)
		{
			g++;
			ret += dp(x/prime[i]);
		}
	}
	ret = (ret + p)/g;
	f[x] = ret;
	return ret;
}

int main()
{
//	freopen("1.out","w",stdout);
	get_prime();
	int t;
	scanf("%d",&t);
	for(int kt=1;kt<=t;kt++)
	{
		int n;
		scanf("%d",&n);
		printf("Case %d: %.8lf\n",kt,dp(n));
	}
	return 0;
}